<?php include TMPL_PATH.'public/header.phtml';?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='javascript:;' class="on"><em>优惠码列表</em></a><span>|</span>
        <a href='<?php echo U('Coupon/coupon_edit');?>' ><em>添加优惠码</em></a><span>|</span>
        <a href='<?php echo U('Coupon/coupon_edit_special');?>' ><em>批量添加优惠码</em></a>
    </div>
</div>
<div class="bk"></div>
<div class="pad_10">
<div class="table-list">
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
            <th align='left' width="200">优惠编码</th>
			<th align='center' width="100">优惠金额</th>
			<th align='center' width="100">订单上限</th>
            <th align='center' width="100">订单下限</th>
            <th align='center' >过期时间</th>
            <th align='center' >优惠码数量</th>
            <th align='center' >使用数量</th>
            <th align='center' >备注</th>
            <th align="left">管理操作</th>
            </tr>
       </thead>
    <tbody>
    <?php foreach($group_coupon as $k=>$v):?>
        	<tr>
					<td align='left'><?php echo $v['favorable_group']?></td>						
                    <td align='center'><?php echo $v['coupon_money'];?><?php if($v['type'] == 4){ echo '% (折扣)';}?></td>
					<td align='center'><?php echo $v['max_amount'];?></td>
					<td align='center'><?php echo $v['min_amount'];?></td>
                                        <td align='center'><?php echo date("Y-m-d",$v['expiration_time']);
                                            if($v['expiration_time']<time()){
                                                echo ' (已过期)';
                                            }
                                      ?></td>
                    <td align='center'><?php echo $v['count']?></td> 
                    <td align='center'><?php echo $v['count'] - $v['use_count']?></td> 
                    <td align='center'><?php echo $v['favorable_group_desc']?></td> 
					<td align='left' style="padding-right:20px;"> 
					<a href="<?php echo U('coupon/coupon_edit_special', 'group_name='.$v['favorable_group']);?>">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;
					<a href="javascript:confirmurl('<?php echo U('coupon/coupon_delete_special', 'group_name='.$v['favorable_group']);?>','确认要删除 吗？')">删除</a>
					</td>
				</tr>
    <?php endforeach;?>    
    <?php
   	if(isset($couponList) && $couponList):
   		foreach ($couponList as $key=>$v):
   ?>
			<tr>
					<td align='left'><?php echo $v['coupon_code']?></td>						
                    <td align='center'><?php echo $v['coupon_money'];?><?php if($v['status'] == 4){ echo '% (折扣)';}?></td>
					<td align='center'><?php echo $v['max_amount'];?></td>
					<td align='center'><?php echo $v['min_amount'];?></td>
                                        <td align='center'><?php echo date("Y-m-d",$v['expiration_time']);
                                            if($v['expiration_time']<time()){
                                                echo ' (已过期)';
                                            }
                                      ?></td>
                    <td align='center'></td> 
                    <td align='center'><?php echo $newlist[$key]['count']?></td> 
                    <td align='center'><?php echo $v['favorable_group_desc']?></td> 
					<td align='left' style="padding-right:20px;"> 
					<!--<?php if($v['send_type'] == 1):?>
					<a href="<?php echo U('coupon/bonus_excel', 'coupon_id='.$v['id']);?>">报表</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<?php endif;?>
					<?php if($v['send_type']  ==1):?>
					<a href="<?php echo U('coupon/coupon_send', 'coupon_id='.$v['id']);?>">发放</a>&nbsp;&nbsp;|&nbsp;&nbsp;
					<?php endif;?>
					<a href="<?php echo U('coupon/coupon_look_list', 'coupon_id='.$v['id']);?>">查看</a>&nbsp;&nbsp;|&nbsp;&nbsp;-->
					<a href="<?php echo U('coupon/coupon_edit', 'coupon_id='.$v['id']);?>">编辑</a>&nbsp;&nbsp;&nbsp;&nbsp;
					<a href="javascript:confirmurl('<?php echo U('coupon/coupon_delete', 'coupon_id='.$v['id']);?>','确认要删除 吗？')">删除</a>
					</td>
				</tr>
	<?php
		endforeach;
		endif;
	?>
   </tbody>
    </table>
<div id="pages"><?php echo $pageShow;?></div>
</div>
</div>
</body>
</html>
